package com.yunchang.springboot.mapper.mwsreport;

import com.yunchang.springboot.models.mwsreportbean.MwsInventoryAdjustments;
import com.yunchang.springboot.models.mwsreportbean.MwsInventoryAdjustmentsDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 亚马逊api获取盘库表 Mapper 接口
 * </p>
 *
 * @author sjd
 * @since 2020-08-21
 */
public interface IMwsInventoryAdjustmentsMapper extends BaseMapper<MwsInventoryAdjustmentsDO> {
    String getLatestDay(@Param("sellerId") String sellerId, @Param("area") String area);

    /**
     * 根据createTime获取对应的数据
     * @param time
     * @return
     */
    List<MwsInventoryAdjustmentsDO> selectByCreateTime(String time);

    /**
     * 根据参数获取对应的quantity的和
     * @param sellerId
     * @param adjustedDate
     * @param sku
     * @param fulfillmentCenterId
     * @param reasonList
     * @return
     */
    Integer selectSumQuantityBySellerIdAndAdjustedDateAndSkuAndFulfillmentCenterIdAndReasonList(@Param("sellerId") String sellerId,@Param("adjustedDate") String adjustedDate,@Param("sku") String sku,@Param("fulfillmentCenterId") String fulfillmentCenterId,@Param("reasonList") List<String> reasonList);

    /**
     * 根据参数获取对应的quantity的和
     * @param sellerId
     * @param sku
     * @param adjustedDate
     * @param reason
     * @return
     */
    Integer selectSumQuantityBySellerIdAndAdjustedDateAndSkuAndReason(String sellerId,String sku,String adjustedDate,String reason);

    /**
     * 根据是否生成财务数据获取对应的数据，limitValue指定获取数据的大小
     * @param financeStatus
     * @param limitValue
     * @param reasonList
     * @param date
     * @return
     */
    List<MwsInventoryAdjustmentsDO> selectByFinanceStatus(@Param("financeStatus") Integer financeStatus,@Param("limitValue") Integer limitValue,@Param("reasonList") List<String> reasonList,@Param("date") String date);

    /**
     * 根据mwsInventoryAdjustmentsList对象集合更新financeStatus
     * @param mwsInventoryAdjustmentsList
     * @return
     */
    int updateFinanceStatusByMwsInventoryAdjustmentsList(@Param("mwsInventoryAdjustmentsList") List<MwsInventoryAdjustmentsDO> mwsInventoryAdjustmentsList);

}
